package com.zbkj.dal.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.dal.entity.user.UserActivityRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author JinXinyu
 * @date 2024-02-14 10:44:33
 */
public interface UserActivityRecordDao extends BaseMapper<UserActivityRecord> {

    @Select("select * from eb_user_activity_record where user_code = #{userCode} and activity_type = #{type} and is_deleted = 0")
    List<UserActivityRecord> selectByType(@Param("userCode") String userCode, @Param("type") String type);

    @Select("select * from eb_user_activity_record where user_code = #{userCode} and activity_type = #{type} and is_deleted = 0 order by id desc limit 1")
    UserActivityRecord selectLastByType(@Param("userCode") String userCode, @Param("type") String type);

}
